package edu.bmstu.rslab;

import javax.swing.*;
import java.awt.event.ActionEvent;

/**
 * Created by Chikh (using IntelliJ IDEA).
* Date: 15.05.2009
* Time: 15:35:54
*/
class stopAction extends AbstractAction {
    private final Timer positioningTimer;
    private final Timer movingTimer;
    private final Action startAction;

    public stopAction(Timer positioningTimer, Timer movingTimer, Action startAction) {
        super("Stop");
        this.positioningTimer = positioningTimer;
        this.movingTimer = movingTimer;
        this.startAction = startAction;
        setEnabled(false);
    }

    public void actionPerformed(ActionEvent e) {
        positioningTimer.stop();
        movingTimer.stop();
        startAction.setEnabled(true);
    }
}
